 /*	
  *				
  *					ISNW ---- It is a war.It is not warcraft!
  *
  *
  *					Author:					zhoukeli(haxixi_keli)
  *					Filename:				CReadFile.h
  *					CreateTime:				2008/12/15
  *					ModifyTime:				2008/12/15
  *
  */

#include "include/IReadFile.h"
#include "include/isnwString.h"

namespace ISNW
{
namespace io
{
	class CReadFile : public IReadFile
	{
	public:
		CReadFile(const c8* fname);
		CReadFile(const core::string& fname);

		virtual ~CReadFile();

	public:
		virtual s32 read(void* buffer,u32 size);

		virtual bool seek(s32 final_pos,bool relative = false);

		virtual s32 getsize() const;

		virtual s32 getpos() const;

		virtual const c8* getfilename() const;

		bool isopen() const {return hfile != 0;}

	protected:
		//! open the file
		bool open();

	protected:
		core::string	filename;
		HANDLE			hfile;
		s32				fppos;
	};
} // end namespace io
} // end namespace ISNW